DEW.List = Backbone.View.extend({

    template: Handlebars.templates['list'],

    categoryId: 0,
    currentListId: 0,
    currentUsuarioId:0,
    events: {
        "click .list_link" : "changeList"
    },
    
    initialize: function() {
        this.listenTo(this.model, 'reset',  this.render);
    },

    render: function() {
        this.$el.html(this.template({
            list: this.model.getByCategory(this.categoryId)
        }));
    },
    changeList: function(e) {
        e.preventDefault();
        this.currentListId = parseInt($(e.target).attr("data-id"));
        this.currentUsuarioId = parseInt($(e.target).attr("data-idUsuario"));
        //this.render();
        this.trigger("changeList",this.currentListId,this.currentUsuarioId);
    }
});